<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>


    <script>

        // 短路    逻辑运算符中   && 见假    || 见真

        console.log(1 || 2);   // 1


        console.log(0 || 2) ;   // 2

        console.log(1 && 2) ;   // 2


        console.log(0 && 2) ;   // 0














        var a = 1 || 2 ;
        console.log(a) ;  // 1

        var b = 0 || 2 ;
        console.log(b) ;  // 2

        var c = 1 && 2 ;
        console.log(c) ;   // 2

        var d = 0 && 2 ;   // 0
        console.log(d) ;


    </script>
    
</body>
</html>